<template>
  <div class="upFileCss">
    <div v-if="booleans">
      <el-row style="height: 60px; line-height: 60px; border-bottom: 1px solid #ccc;margin-bottom: 20px;">
        <el-col :span="12">
          <div style="font-size: 20px;color: #000;font-weight: bold;">模板列表</div>
        </el-col>
        <el-col :span="12">
          <div>
            <el-button style="float: right;" type="primary" @click="getTemplate()">+添加</el-button>
          </div>
        </el-col>
      </el-row>
      <el-table :data="templateList" :border="true">
        <el-table-column label="序号" type="index"></el-table-column>
        <el-table-column label="模板名" prop="modelName"></el-table-column>
        <el-table-column label="模板类型" :formatter="modelFormatter"></el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
            <el-button size="mini" plain>查看</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div v-else>
      <el-row style="height: 60px; line-height: 60px; border-bottom: 1px solid #ccc;margin-bottom: 20px;">
        <el-col :span="12">
          <div style="font-size: 20px;color: #000;font-weight: bold;">模板信息</div>
        </el-col>
      </el-row>
      <el-form>
        <el-row>
          <el-col :span="12">
            <div class="grid-content bg-purple-light e-height">
              <el-form-item label="模板名" label-width="200px">
                <el-input class="inputForm" style="width: 350px"></el-input>
              </el-form-item>
            </div>
          </el-col>
          <el-col :span="12">
            <div class="grid-content bg-purple-light e-height">
              <el-form-item label="模板类型" label-width="200px">
                <el-input class="inputForm" style="width: 350px"></el-input>
              </el-form-item>
            </div>
          </el-col>
        </el-row>
        <p class="p-title">系统管理权限</p>
        <el-row>
          <el-col :offset="2" :span="21">
            <el-checkbox-group v-model="checked">
              <el-checkbox label="单位管理" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="用户管理" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="个人信息" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="审计信息" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="角色管理" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="权限管理" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="系统设置" style="margin:0;width:270px;"></el-checkbox>
            </el-checkbox-group>
          </el-col>
        </el-row>
        <p class="p-title">项目报建权限</p>
        <el-row>
          <el-col :offset="2" :span="21">
            <el-checkbox-group v-model="checked">
              <el-checkbox label="项目信息报送" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="项目查询（信息报送）" style="margin:0;width:270px;"></el-checkbox>
            </el-checkbox-group>
          </el-col>
        </el-row>
        <p class="p-title">设计方案权限</p>
        <el-row>
          <el-col :offset="2" :span="21">
            <el-checkbox-group v-model="checked">
              <el-checkbox label="方案申请" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="通知设计单位上传图纸（设计方案）" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="其他资料上传（设计方案）" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="设计图纸上传（设计方案）" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="提交方案申请（设计方案）" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="项目信息查询" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="接收" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="补正" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="受理" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="暂停" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="退回修改" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="结果录入" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="分发并联部门（牵头部门）" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="图纸批注" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="征询意见" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="审批结果" style="margin:0;width:270px;"></el-checkbox>
            </el-checkbox-group>
          </el-col>
        </el-row>
        <p class="p-title">系统管理权限</p>
        <el-row>
          <el-col :offset="2" :span="21">
            <el-checkbox-group v-model="checked">
              <el-checkbox label="单位管理" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="用户管理" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="个人信息" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="审计信息" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="角色管理" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="权限管理" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="系统设置" style="margin:0;width:270px;"></el-checkbox>
            </el-checkbox-group>
          </el-col>
        </el-row>
        <p class="p-title">施工许可权限</p>
        <el-row>
          <el-col :offset="2" :span="21">
            <el-checkbox-group v-model="checked">
              <el-checkbox label="施工申请" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="通知设计单位上传图纸（施工许可）" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="其他资料上传（施工许可）" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="设计图纸上传（施工许可）" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="提交施工许可申请（施工许可）" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="项目信息查询（施工许可）" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="接收（施工许可）" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="补正（施工许可）" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="受理（施工许可）" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="退回修改（施工许可）" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="结果录入（施工许可）" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="接收（审图）" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="退回修改（审图）" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="一审（图审）" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="二审（图审复核）" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="三审（图审审定）" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="图审通过" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="图审签章" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="生成意见通知书" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="打印意见通知书" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="审批结果录入" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="图纸批注" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="分发并联部门" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="审查意见查看" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="反馈意见查看" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="送审情况查看" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="审批结果查看" style="margin:0;width:270px;"></el-checkbox>
            </el-checkbox-group>
          </el-col>
        </el-row>
        <p class="p-title">过程咨询权限</p>
        <el-row>
          <el-col :offset="2" :span="21">
            <el-checkbox-group v-model="checked">
              <el-checkbox label="咨询申请" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="意见回复" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="意见查看" style="margin:0;width:270px;"></el-checkbox>
            </el-checkbox-group>
          </el-col>
        </el-row>
        <p class="p-title">事中事后监管权限</p>
        <el-row>
          <el-col :offset="2" :span="21">
            <el-checkbox-group v-model="checked">
              <el-checkbox label="提出监管意见" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="监管意见回复" style="margin:0;width:270px;"></el-checkbox>
              <el-checkbox label="监管意见查看" style="margin:0;width:270px;"></el-checkbox>
            </el-checkbox-group>
          </el-col>
        </el-row>
      </el-form>
      <el-footer class="el_foot">
        <el-button type="primary">提交更改</el-button>
        <el-button type="primary" style="margin-left: 30px;">保存</el-button>
      </el-footer>
    </div>
  </div>
</template>

<script>
  import {$aos} from '../../../store/state';
  import {http} from '../../../assets/commonjs/axios';

  export default {
    data() {
      return {
        account: $aos.account(),
        booleans: true,
        checked: [],
        templateList: [],
        token: '',
      }
    },
    created() {
      $aos.getItem('token').then(res => {
        this.token = res;
        this.GetTemplateList();
      });
    },
    methods: {
      // templateTypeName:['管理员','建设单位','设计单位','规划部门','建设部门','并联部门','告知部门','审图公司','测绘院'],
      GetTemplateList() {
        http('post', 'SystemManager/GetTemplateList', {
          token: this.token
        }).then(response => {
          let res = response.data;
          if (res.code == 100) {
            this.templateList = res.list;
          }
        })
      },
      modelFormatter(row) {
        let modeltype = row.modeltype;
        switch (modeltype) {
          case 0:
            return "管理员";
          case 1:
            return "建设单位";
          case 2:
            return "设计单位";
          case 3:
            return "规划部门";
          case 4:
            return "建设部门";
          case 5:
            return "并联部门";
          case 6:
            return "告知部门";
          case 7:
            return "审图公司";
          case 8:
            return "测绘院";
        }
      },
      getTemplate() {
        this.booleans = false;
      }
    },
    name: "templateSetting"
  }
</script>

<style scoped>
  .upFileCss {
    margin-bottom: 50px;
    padding: 20px;
    background: #fff;
    box-shadow: 0 0 3px #ccc;
  }

  .p-title {
    height: 30px;
    line-height: 30px;
    font-size: 16px;
    font-weight: bolder;
    padding-left: 100px;
    box-sizing: border-box;
  }

  .el_foot {
    width: 40%;
    text-align: center;
    margin: 40px auto;
  }
</style>
